package com.heima.article.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ArticleMapper;
import com.heima.article.service.AddCommentService;
import com.heima.model.article.pojos.ApArticle;
import org.springframework.stereotype.Service;

@Service
public class AddCommentServiceImpl extends ServiceImpl<ArticleMapper, ApArticle> implements AddCommentService {

    @Override
    public void add(String message) {
        ApArticle apArticle = this.getOne(Wrappers.<ApArticle>lambdaQuery().eq(ApArticle::getId, Long.valueOf(message)));
        Integer comment = apArticle.getComment()+1;
        apArticle.setComment(comment);
        this.updateById(apArticle);
    }
}
